package com.example.demo.web.manage.controller.admin;

import com.example.demo.web.common.annotation.OperateLog;
import com.example.demo.web.common.model.Ret;
import com.example.demo.web.manage.dto.DeptDto;
import com.example.demo.web.manage.service.DeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.noear.solon.annotation.*;

/**
 * @author airhead
 */
@Component(tag = "adminApi")
@Api("管理端 部门管理")
public class DeptController {
  @Inject private DeptService service;

  @Mapping(value = "listWithException")
  @Get
  @ApiOperation("获取列表但返回异常")
  public Ret<List<DeptDto>> listWithException() {
    return Ret.ok(service.listWithException());
  }

  @Mapping(value = "list")
  @Get
  @ApiOperation("获取列表")
  @OperateLog
  public Ret<List<DeptDto>> list() {
    return Ret.ok(service.list());
  }
}
